package databaseVersionControl.domain.ddl;

import databaseVersionControl.domain.db.Column;
import databaseVersionControl.infra.connection.DataBaseProxy;

public class AlterTable {

	private String tableName;
	
	public AlterTable(String tableName) {
		this.tableName = tableName;
	}
	
	public HardCodedStatement dropColumn(String columnName) {
		return new HardCodedStatement(String.format("ALTER TABLE %S DROP COLUMN %S;", tableName, columnName));
	}
	
	public HardCodedStatement dropConstraint(String constraintName) {
		return new HardCodedStatement(String.format("ALTER TABLE %S DROP CONSTRAINT %S;", tableName, constraintName));
	}
	
	public HardCodedStatement addColumn(Column column) {
		return new HardCodedStatement(String.format("ALTER TABLE %S ADD %S;", tableName, DataBaseProxy.translate(column)));
	}
	
	public void addConstraint() {
		String.format("ALTER TABLE TABLE_NAME ADD CONSTRAINT CONSTRAINT_NAME FOREIGN KEY(COLUMN_NAME) REFERENCES TABLE_REFERENCED(KEY)", "");
	}
	
}